<template>
	<view style="background-color: #f1f2e5;;">
		<u-notice-bar  ref="noticeBar" class="tonghzhi" :text="text1" color="red" mode="closable" v-show="tongzhi" bgColor="" speed="80"></u-notice-bar>
		<u-swiper :list="list1" :circular=true height='250'></u-swiper>
		<view style="background-color: white;border-radius:10px;margin: 10px;padding: 10px;margin-bottom: 0px;">
			<u-row>
				{{goodsinfo.goodsName}}
			</u-row>
			<u-line></u-line>
			<u-row>
				<u-col @tap="auctionCloseShow=true" span=4>
					<!-- {{paiflag == 0?'待拍卖':paiflag == 1?'正在拍卖':!cyflag?'拍卖结束':cgflag?'拍卖成功':'拍卖失败'}} -->
					<u-image v-if="paiflag == 1" height="40px" width="100" mode="aspectFit"
						src="../../static/bebeing1.png"></u-image>
					<u-image v-if="paiflag == 2&&cyflag&&!cgflag" height="40px" width="100" mode="aspectFit"
						src="../../static/loser 1.png"></u-image>
					<u-image v-if="paiflag == 2&&cyflag&&cgflag" height="40px" width="100" mode="aspectFit"
						src="../../static/success.png"></u-image>
					<u-image v-if="paiflag == 2&&!cyflag" height="40px" width="100" mode="aspectFit"
						src="../../static/over.png"></u-image>
					<u-image v-if="paiflag == 0" height="40px" width="120" mode="aspectFit" src="../../static/wait.png">
					</u-image>
				</u-col>
				<u-col style="text-align: right;" span=8>
					<view v-if="paiflag==0">{{goodsinfo.startTime}}开始</view>
					<view v-if="paiflag==1"><u-count-down :millisecond="true" @finish="auctionClose" :time="daojishi" format="DD天HH小时mm分ss.SSS秒"></u-count-down>结束</view>
				</u-col>
			</u-row>
			<u-row style="font-size: 12px;color: #666666;margin-top: 15px;">
				{{paiflag == 0?'起拍价':paiflag == 1?'当前价':'成交价'}}:<text
					style="font-size: 25px;color:#EB0045;font-weight:700">￥{{goodsinfo.startPrice}}</text>
			</u-row>
			<u-row style="font-size: 15px;color:#B099B0;margin-top: 10px;">
				<u-col span="4.5">
					围观 1234 次
				</u-col>
				<u-col span="5">
					报名 0 次
				</u-col>
				<u-col span="2.5">
					报价 0 次
				</u-col>
			</u-row>
		</view>


		<!-- <u-tabs-swiper ref="tabsaa" :list="list" ></u-tabs-swiper> -->
		<u-sticky bgColor="#F1F2E5" zIndex="9999">
			<u-tabs :current="current" @change="tabsChange" ref="uTabs" :list="list">
			</u-tabs>
		</u-sticky>
		<swiper :style="'height:'+hightt+'px;'" :current="swiperCurrent" @change="transition">
			<swiper-item style="height: 100%;">
				<view id="a" ref="aaa">

					<view
						style="margin-top: 15px;padding: 10px;border-radius:10px;margin: 10px;background-color:white;">
						<u-row>
							<u-col style="color:#999999;font-size: 14px;" span=2>
								起拍价:
							</u-col>
							<u-col style="font-size: 14px;" span=4>
								￥{{goodsinfo.startPrice}}
							</u-col>
							<u-col style="color:#999999;font-size: 14px;" span=2>
								保证金:
							</u-col>
							<u-col style="font-size: 14px;" span=4>
								￥12255
							</u-col>
						</u-row>
						<u-row style="margin-top: 5px;">
							<u-col style="color:#999999;font-size: 14px;" span=2>
								加价幅度:
							</u-col>
							<u-col style="font-size: 14px;" span=4>
								￥1000
							</u-col>
							<u-col style="color:#999999;font-size: 14px;" span=2>
							</u-col>
							<u-col style="font-size: 14px;" span=4>
							</u-col>
						</u-row>
					</view>
					<view v-if="paiflag == 1"
						style="margin-top: 15px;padding-bottom: 10px;border-radius:10px;margin: 10px;background-color:white;overflow:hidden">
						<u-row
							style="background-color: #cbcbcb;line-height: 30px;color: #666666;padding-top: 10px;padding-left: 10px;padding-right: 10px;">
							<u-col style="text-align: center; " span="3">
								排名
							</u-col>
							<u-col style="text-align: center; " span="3">
								竞拍时间
							</u-col>
							<u-col style="text-align: center; " span="3">
								竞拍者
							</u-col>
							<u-col style="text-align: center; " span="3">
								竞拍报价
							</u-col>

						</u-row>
						<u-line color="#cb133e"></u-line>
						<u-row v-for="(a,b) in chujialist.slice(0,5)" style="margin-bottom: 10px;">
							<u-col style="text-align: center;" span="2.5">
								{{b+1}}
							</u-col>
							<u-col style="text-align: center; " span="3.5">
								{{a.bidTime |datefilter}}
							</u-col>
							<u-col style="text-align: center;" span="3">
								{{a.loginName}}
							</u-col>
							<u-col style="text-align: center;color: red;" span="3">
								¥{{a.maxBid}}
							</u-col>

						</u-row>
						<u-line color="#cb133e"></u-line>
						<u-row style="font-weight: 700;margin-left: 10px;margin-top: 10px;"
							@tap="lishijingjiashow= !lishijingjiashow">
							<u-col span=11>
								查看历史叫价
							</u-col>
							<u-col span=1>
								<u-icon name="arrow-right"></u-icon>
							</u-col>
						</u-row>
					</view>
				</view>
			</swiper-item>
			<swiper-item style="height: 100%;">
				<view id="b" ref="vvv">
					<view
						style="margin-top: 15px;background-image:url(../../static/bjbj.png);background-position:-60px;padding: 10px;border-radius:10px;margin: 10px;">
						<u-row>
							<u-col span="1.5">

								<u-image height="20px" width="50" mode="aspectFit" src="../../static/iconpng.png">
								</u-image>
							</u-col>
							<u-col span="2.5">
								<text style="font-family:icomoon;color: white;font-size: 15px;">随心拍卖</text>

							</u-col>
							<u-col style="font-size: 14px;color:white;" span="8.5">
								已鉴定有证书 · 正品保证 · 假一赔三
							</u-col>
						</u-row>
					</view>
					<view
						style="margin-top: 15px;padding: 10px;border-radius:10px;margin: 10px;background-color:white;">
						<u-row>
							<u-col span=2>
								<u-avatar :src="'http://101.43.223.224:8765/image/getImageById?id='+sellerInfo.imageId">
								</u-avatar>
							</u-col>
							<u-col span="7">
								{{sellerInfo.userName}}
							</u-col>
							<u-col span="3">
								<u-button @click="homepage()"
									:customStyle="{fontSize:'12px',backgroundColor:'#B7192F',color:'#FFFFFF',borderRadius: '50px'}">
									进个人主页</u-button>
							</u-col>
						</u-row>
						<u-row style="margin-top:10px ;">
							<u-col span=6>
								他的拍品
							</u-col>
							<u-col style="text-align: right;font-size: 15px;" span="5">
								查看全部
							</u-col>
							<u-col style="text-align: right;font-size: 15px;" span="1">
								<u-icon name="arrow-right"></u-icon>
							</u-col>
						</u-row>
						<goodslist :list="sellerGoods"></goodslist>
					</view>
					<view
						style="margin-top: 15px;background-color: white;;padding: 10px;border-radius:10px;margin: 10px;">
						<view style="">
							商品详情
						</view>
						<view style="margin-bottom: 10px; background-color: #F2F2F2;padding: 10px;color:#B099B0;">
							<view v-for="a in shuxinglist">{{a.specs}}：{{a.specsValue}}</view>
						</view>
						<u-image v-for=" a in viewimgs" height="600" width="100%" :src="a"></u-image>

					</view>
				</view>
			</swiper-item>
		</swiper>




		<view style="height: 85px;"></view>
		<view
			style="height: 65px;width: 100%;background-color: white; position:fixed;bottom: 0px;border-top: 1px solid #999999;z-index: 10076;">
			<u-row>
				<u-col span="2">
					<!-- <u-button type="success" :custom-style="{backgroundColor:'#d7000f',border:'0px'}" shape="circle" style="width: 69px;height: 30px;">关注＋</u-button> -->
					<u-icon @click="collect" label="收藏" label-pos="botton" size="35px" v-if="scflag" name="star-fill">
					</u-icon>
					<u-icon @click="collect" label="收藏" label-pos="botton" size="35px" v-else name="star"></u-icon>
				</u-col>
				<u-col span="2">
					<!-- <u-button type="success" :custom-style="{backgroundColor:'#d7000f',border:'0px'}" shape="circle" style="width: 69px;height: 30px;">关注＋</u-button> -->
					<u-icon @click="zhuanfa" label="转发" label-pos="botton" size="35px" name="share"></u-icon>
				</u-col>
				<u-col span="8">
					<u-button v-if="paiflag==1&&cyflag" :custom-style="{backgroundColor:'#d7000f',border:'0px'}"
						@click="jiaojiashow = !jiaojiashow;lishijingjiashow = false" type="success"
						ripple-bg-color="black"
						style="margin: 10px; width: 95%;background-image: url('../../static/anbk.png');background-position:-30px -42px;"
						shape="circle" :ripple="true" text="叫价"></u-button>
					<u-button v-if="paiflag==0&&cyflag" :custom-style="{border:'0px'}" disabled type="success"
						ripple-bg-color="black"
						style="margin: 10px; width: 95%;background-image: url('../../static/anbk.png');background-position:-30px -42px;"
						shape="circle" :ripple="true" text="等待开拍"></u-button>
					<u-button v-if="!cyflag&&paiflag!=2" @click="tobaozhengjin"
						:custom-style="{backgroundColor:'#d7000f',border:'0px'}" type="success" ripple-bg-color="black"
						style="margin: 10px; width: 95%;background-image: url('../../static/anbk.png');background-position:-30px -42px;"
						shape="circle" :ripple="true" text="缴纳保证金报名"></u-button>
					<u-button v-if="paiflag==2" :custom-style="{backgroundColor:'#d7000f',border:'0px'}" disabled
						type="success" ripple-bg-color="black"
						style="margin: 10px; width: 95%;background-image: url('../../static/anbk.png');background-position:-30px -42px;"
						shape="circle" :ripple="true" text="拍卖已结束"></u-button>
				</u-col>
			</u-row>
		</view>
		<u-popup :customStyle="{borderTop:'1px solid #444444',backgroundColor:'white'}" :overlay="false" mode="bottom"
			:show="lishijingjiashow" :closeOnClickOverlay="true">
			<u-row style="font-size: 20px;line-height: 45px;">
				<u-col span=2 style="font-size: 16px;">
					当前价:
				</u-col>
				<u-col span=3 style="color: red;">
					￥{{goodsinfo.startPrice}}
				</u-col>
				<u-col style="font-size: 14px;color:#8b8b8b" span=6>
					加价幅度：￥{{jiajiafudu}}
				</u-col>
				<u-col span=1>
					<u-icon @click="lishijingjiashow = !lishijingjiashow" size=20 name="close">

					</u-icon>
				</u-col>
			</u-row>
			<u-line color="#444444"></u-line>
			<u-row style="background-color: #cbcbcb;line-height: 30px;color: #666666;">
				<u-col style="text-align: center; " span="3">
					排名
				</u-col>
				<u-col style="text-align: center; " span="3">
					竞拍时间
				</u-col>
				<u-col style="text-align: center; " span="3">
					竞拍者
				</u-col>
				<u-col style="text-align: center; " span="3">
					竞拍报价
				</u-col>


			</u-row>
			<scroll-view scroll-y style="height: 200px;">

				<u-row v-for="(a,b) in chujialist" style="margin-bottom: 10px;">
					<u-col style="text-align: center;" span="2.5">
						{{b+1}}
					</u-col>
					<u-col style="text-align: center; " span="3.5">
						{{a.bidTime |datefilter}}
					</u-col>
					<u-col style="text-align: center;" span="3">
						{{a.loginName}}
					</u-col>
					<u-col style="text-align: center;color: red;" span="3">
						¥{{a.maxBid}}
					</u-col>


				</u-row>
			</scroll-view>
			<view style="height: 66px;">

			</view>
		</u-popup>



		<u-popup :customStyle="{borderTop:'1px solid #444444',backgroundColor:'#white'}" zIndex="10095" mode="bottom"
			:show="jiaojiashow">
			<u-row style="font-size: 20px;line-height: 45px;">
				<u-col span=2 style="font-size: 16px;">
					当前价:
				</u-col>
				<u-col span=3 style="color: red;">
					￥{{goodsinfo.startPrice}}
				</u-col>
				<u-col style="font-size: 14px;color:#999999" span=6>
					加价幅度：￥{{jiajiafudu}}
				</u-col>
				<u-col span=1>
					<u-icon @click="jiaojiashow = !jiaojiashow" size=20 name="close">

					</u-icon>
				</u-col>
			</u-row>

			<u-line color="#444444"></u-line>
			<u-row style="font-size: 20px;">
				<u-col span="3">
					叫价：
				</u-col>
				<u-col span="3">

				</u-col>
				<u-col span=3>
					￥{{goodsinfo.startPrice+jiajia}}
				</u-col>
				<u-col span="3">
				</u-col>
			</u-row>
			<u-row style="font-size: 20px;">
				<u-col span="3">
					加价：
				</u-col>
				<u-col span=3>
					<u-button shape="circle" :disabled="jiajia == 0"
						@click="jiajia -= jiajiafudu ; jiaojia -= jiajiafudu" style="width: 40px;" type="error"
						icon="minus"></u-button>
				</u-col>
				<u-col span=3>
					￥{{jiajia}}
				</u-col>
				<u-col span=3>
					<u-button shape="circle" @tap="jia" style="width: 40px;" type="success" icon="plus"></u-button>
				</u-col>
			</u-row>
			<view style="height: 66px;">
				<u-button shape="circle" :custom-style="{backgroundColor:'#d7000f',border:'0px'}"
					:disabled="jiajia == 0" @click="jiaojiabtn" type="success" ripple-bg-color="black"
					style="margin: 10px; width: 95%;" :ripple="true" text="叫价"></u-button>
			</view>
		</u-popup>
		<u-modal @cancel="scshow=false" @confirm="quxiaosc" :show="scshow" title="是否取消收藏" :showCancelButton="true">
		</u-modal>
        	<u-popup :round="20" mode="center" :show="auctionCloseShow" >
                    <view>
                        <view style="margin: 20px;">
                        <text>恭喜{{auctionCloseUserName}}以<text style="color:#EB0045;font-size: 20px;">￥{{auctionClosePrice}}</text>价格竞拍成功</text>
                        </view>
                        <u-line></u-line>
                        <u-button :customStyle="{border:'0px',borderRadius:'0px 0px 20px 20px'}" @click="auctionCloseShow=false" :plain="true">123</u-button>
                    </view>
        		</u-popup>
	</view>
</template>

<script>
	import goodslist from '@/common/goodslist6/goodslist6.vue'
	var that
	export default {
		
		components: {
			goodslist
		},
		data() {
			return {
				tongzhi:false,
				text1: '用户宋xx收藏了该商品 ',
                auctionCloseUserName:'llh',
                auctionClosePrice:'123213',
                auctionCloseShow:false,
				list: [{
					name: '拍卖'
				}, {
					name: '详情'
				}],
				swiperCurrent: 0,
				hightt: 350,
				current: 0,
				ws: '',
				sellerGoods: [],
				nowdate: new Date(),
				scshow: false,
				sellerInfo: {},
				ws: null,
				chujialist: [],
				userId: 1,
				paiflag: 0,
				cyflag: false,
				cgflag: false,
				id: 1,
				jiaojia: 125324,
				daojishi: 0,
				goodsinfo: {},
				scflag: false,
				jiajia: 1000,
				jiajiafudu: 1000,
				timeOnline: null,
				shuxinglist: [],
				timeData: {},
				viewimgs: [],
				lishijingjiashow: false,
				jiaojiashow: false,
				list1: [
					'https://img2.baidu.com/it/u=3035785520,539213411&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=333',
					'https://t11.baidu.com/it/u=2531934849,177500009&fm=30&app=106&f=JPEG?w=640&h=960&s=3F25D403E0600EBE6485F8BF0300E002',
					'https://pic17.997788.com/_pic_search/00/28/17/39/28173918h.jpg',
				]
			}
		},
		onLoad(op) {

			var userId = uni.getStorageSync("loginId")
			if (userId) {
				this.userId = userId
			}
			that = this
			console.log(that.userId)
			var id = op.id
			if (id) {
				this.id = id
			}
			uni.request({
				url: 'http://' + that.$host + ':' + that.$port + '/publish/publishId/' + that.id,
				success(res) {
					that.goodsinfo = res.data.obj
					var data = new Date().getTime()
					var startTime = new Date(that.goodsinfo.startTime)
					var startdata = startTime.getTime()
					that.goodsinfo.startTime = startTime.getFullYear() + '年' + (startTime.getMonth() + 1) + '月' +
						startTime.getDate() + "日" + " " + startTime.getHours() + ":" + startTime.getMinutes()
					var endTime = new Date(that.goodsinfo.endTime)
					var enddata = endTime.getTime()
					that.goodsinfo.endTime = endTime.getFullYear() + '年' + (endTime.getMonth() + 1) + '月' + endTime
						.getDate() + "日" + " " + endTime.getHours() + ":" + endTime.getMinutes()
					if (data < startdata) {

						that.paiflag = 0
						that.daojishi = startdata - data
						that.getheight()
						that.swiperCurrent = 1
						that.current = 1
					} else if (data > enddata) {
						that.paiflag = 2
					} else {
						that.daojishi = enddata - data
						that.paiflag = 1
					}
					if (that.paiflag == 1) {
						uni.request({
							url: 'http://' + that.$host + ':' + that.$port +
								'/BidRecordController/getRecordOfBid?roomId=' + that.id,
							success(res2) {
								// if(res2.data.obj){
								//     that.goodsinfo.startPrice = res2.data.obj
								// }
								that.chujialist = res2.data.obj.sort((a, b) => {
									return b.maxBid - a.maxBid
								})
								that.getheight1()
								console.log(res2.data)
							}
						})
						uni.request({
							url: 'http://' + that.$host + ':' + that.$port +
								'/BidRecordController/getCurrentPrice?key=' + that.id,
							success(res2) {
								if (res2.data.obj) {
									that.goodsinfo.startPrice = res2.data.obj
								}
								console.log(res2.data)
							}
						})
					}

					var arr = that.goodsinfo.imgId.split(',')
					var arrs = that.goodsinfo.imgViewId.split(',')
					var aa = arr.map(a => {
						return 'http://101.43.223.224:8765/image/getImageById?id=' + a
					})
					console.log(aa)
					that.jiaojia = parseInt(that.goodsinfo.startPrice)
					that.list1 = aa
					that.viewimgs = arrs.map(a => {
						return 'http://101.43.223.224:8765/image/getImageById?id=' + a
					})
					uni.request({
						url: 'http://' + that.$host + ':' + that.$port + '/clientuser/clientUserId?id=' +
							res.data.obj.sellerId,
						success(res4) {
							that.sellerInfo = res4.data.obj
							console.log(res4)
						}
					})
					uni.request({
						url: 'http://' + that.$host + ':' + that.$port +
							'/client/auction/getGoodsByUserIdLimit6?userId=' + res.data.obj.sellerId,
						success(res3) {
							that.sellerGoods = res3.data.obj
						}
					})
					uni.request({
						url: 'http://' + that.$host + ':' + that.$port +
							'/publish/getSpecsByGoodId?goodsNumber=' + that.goodsinfo.goodsNumber,
						success(res1) {
							console.log(res.data)
							that.shuxinglist = res1.data.obj
						}
					})
				}
			})

			uni.request({
				url: 'http://' + that.$host + ':' + that.$port +
					'/client/auction/getGoodsEarnestMoneyByUserId?userId=' + that.userId + "&goodsId=" + that.id,
				success(res) {
					console.log(res.data.obj)
					if (res.data.flag) {
						that.cyflag = true
						that.cgflag = res.data.obj.transactionStatus == '1' ? true : false
					} else {
						that.cyflag = false
					}
					if (that.paiflag == 1 && that.cyflag) {
						that.ws = uni.connectSocket({
							url: 'ws://' + that.$host + ':' + that.$port + '/websocket/' + 'room' + that
								.id + '/' + uni.getStorageSync('loginId') + '/' + uni.getStorageSync(
									'userName'),
							success() {
								uni.$u.toast("连接成功")
							}
						})
						uni.onSocketOpen(function(res) {
							// uni.$u.toast('WebSocket连接已打开！')
						});
						uni.onSocketError(function(res) {
							uni.$u.toast('WebSocket连接打开失败，请检查！')
						});
						//    that.ws.onMessage(function (res) {
						//   var data = JSON.parse(res.data)
						//   uni.$u.toast(data.maxBid)
						//   that.goodsinfo.startPrice  = data.maxBid
						// })
						uni.onSocketMessage(function(res) {
							var data = JSON.parse(res.data)
							console.log(data);
                            if(data.type!=undefined&&data.type){
                                that.paiflag = 2
                                that.auctionClosePrice = data.price
                                that.auctionCloseUserName = data.userName
                                if(uni.getStorageSync('userName')==data.userName){
                                    that.cgflag = true
                                }
                                that.auctionCloseShow=true
                            }else{
							uni.$u.toast(data.maxBid)
							that.chujialist.unshift(data)
							that.goodsinfo.startPrice = data.maxBid
                            }
						});
						uni.onSocketClose(function(res) {    
							uni.$u.toast('WebSocket 已关闭！')
						});

					}
				}

			})
			uni.request({
				url: 'http://' + that.$host + ':' + that.$port + '/table/selectCollect?userId=' + that.userId +
					'&goodsid=' + that.id,
				success(res) {
					that.scflag = res.data.obj
				}
			})

		},
		
		methods: {
            auctionClose(){
              uni.request({
                  url: 'http://' + that.$host + ':' + that.$port + '/BidRecordController/auctionClose?id='+that.id,
              })  
            },
			zhuanfa() {
			   // uni.showShareMenu({
			   //    withShareTicket: true,
			   //    success: function () {
			   //      console.log('已打开分享菜单')
			   //    }
			   //  })
			      plus.runtime.openURL("weixin://", function(res) {
			         console.log(res);
			      });

			},
			getheight() {
				setTimeout(function() {
					uni.createSelectorQuery().in(that).select("#b").boundingClientRect(data => {
						that.hightt = data.height + 20
					}).exec()
				}, 1000)

			},
			getheight1() {
				setTimeout(function() {
					uni.createSelectorQuery().in(that).select("#a").boundingClientRect(data => {
						if (data.height > 350) {

							that.hightt = data.height + 20
						} else {
							that.hightt = 350
						}
					}).exec()
				}, 1000)

			},
			homepage() {
				var that = this
				uni.navigateTo({
					url: '/pages/mine/homepage/homepage?id=' + that.goodsinfo.sellerId
				})
			},
			tabsChange(e) {
				console.log(this.$refs.vvv.$el.offsetHeight)
				// var qq = uni.createSelectorQuery()
				// var noderef = qq.select('#a')
				// noderef.boundingClientRect(data =>{
				//     alert(1)
				//       console.log("得到布局位置信息" + JSON.stringify(data));
				// })

				if (e.index == 0) {
					uni.createSelectorQuery().in(this).select("#a").boundingClientRect(data => {
						if (!data.height > 350) {

							this.hightt = 350
						} else {
							this.hightt = data.height + 20
						}
					}).exec()
				} else {
					uni.createSelectorQuery().in(this).select("#b").boundingClientRect(data => {
						this.hightt = data.height + 20
					}).exec()
				}
				this.swiperCurrent = e.index;
			},
			// swiper-item左右移动，通知tabs的滑块跟随移动
			transition(e) {
				if (e.detail.current == 0) {
					uni.createSelectorQuery().in(this).select("#a").boundingClientRect(data => {
						if (!data.height > 350) {

							this.hightt = 350
						} else {
							this.hightt = data.height + 20
						}
					}).exec()
				} else {
					uni.createSelectorQuery().in(this).select("#b").boundingClientRect(data => {
						this.hightt = data.height + 20
					}).exec()
				}
				this.current = e.detail.current
				console.log(e.detail.current, '-------')
			},

			quxiaosc() {
				var qe = this.$getlogin()
				if (!qe) {
					return 1
				}
				// var that = this
				uni.request({
					url: 'http://' + that.$host + ':' + that.$port + '/table/delCollect?userId=' + that.userId +
						'&goodsid=' + that.id,
					success(res) {

						if (res.data.flag) {
							that.scshow = false
							that.scflag = false
						}
					}
				})
			},

			collect() {
				var qe = this.$getlogin()
				if (!qe) {
					return 1
				}
				console.log(1)
				// var that = this
				if (!this.scflag) {
					this.scflag = !this.scflag
					uni.request({
						url: 'http://' + that.$host + ':' + that.$port + '/table/collect?userId=' + that.userId +
							'&goodsid=' + that.id,
						success(res) {
							console.log(res.data)
						}
					})
				} else {
					this.scshow = true
				}
			},
			tobaozhengjin() {
				var qe = this.$getlogin()
				if (!qe) {
					return 1
				}
				// var that = this
				uni.navigateTo({
					url: '/pages/index/baozhengjin?id=' + that.id
				})
			},
			onChange(e) {
				this.timeData = e
			},
			jia(e) {
				console.log(e)
				this.jiajia += this.jiajiafudu
				this.jiaojia += this.jiajiafudu
			},

			jiaojiabtn() {
				this.jiaojiashow = !this.jiaojiashow;
				// this.ws.send(JSON.stringify({price:this.jiajia,basePrice:this.goodsinfo.startPrice}))
				uni.sendSocketMessage({
					data: JSON.stringify({
						price: this.jiajia,
						basePrice: this.goodsinfo.startPrice
					})
				});
				uni.$u.toast('发送')
				this.jiajia = this.jiajiafudu;
			}
		},
		filters: {
			datefilter(datastr) {
				var data = new Date(datastr)
				if (that.nowdate.getFullYear() == data.getFullYear() && that.nowdate.getMonth() + 1 == data.getMonth() +
					1) {
					if (that.nowdate.getDate() == data.getDate()) {
						return '今天 ' + data.getHours() + ':' + data.getMinutes() + ":" + data.getSeconds()
					} else if (that.nowdate.getDate() == data.getDate() + 1) {
						return '昨天 ' + data.getHours() + ':' + data.getMinutes() + ":" + data.getSeconds()

					} else {
						return datastr
					}
				} else {
					return datastr
				}
			}
		}
	}
</script>

<style>
	@font-face {
		font-family: 'icomoon';
		src: url('@/font/Alimama_ShuHeiTi_Bold.ttf') format('truetype'),
			url('@/font/Alimama_ShuHeiTi_Bold.woff') format('woff'),
			url('@/font/Alimama_ShuHeiTi_Bold.woff2') format('woff2');
	}

	.xie {
		width: 0px;
		border-right: 17px solid transparent;
		border-top: 27px solid transparent;

		border-left: 17px solid #666666;

		border-bottom: 26px solid #666666;
		background-color: #999999;
	}

	.bb {
		color: black;
		background-color: white;
		border-radius: 5px 5px 5px 5px;
	}
	.tonghzhi{
		position: fixed;
		z-index: 1000;
		width: 100%;
		/* background-color: none; */
		animation: 6s ease infinite;
		
	}
</style>
